package com.yesorno.ui;

import android.content.Context;
import android.util.AttributeSet;
import android.view.Gravity;
import android.widget.LinearLayout;

import com.yesorno.activity.R;

public class MyMenuList extends LinearLayout {
	public MyMenuList(Context context, int selectIndex) {
		super(context);
		setLayoutParams();
		this.setGravity(Gravity.RIGHT);
		this.addView(new MenuLinearLayout(context, R.string.bottom_menu_hall,
				R.drawable.hall_select, R.drawable.hall_unselect));
		this.addView(new MenuLinearLayout(context, R.string.bottom_menu_info,
				R.drawable.info_select, R.drawable.info_unselect));
		this.addView(new MenuLinearLayout(context, R.string.bottom_menu_data,
				R.drawable.data_select, R.drawable.data_unselect));
		this.addView(new MenuLinearLayout(context, R.string.bottom_menu_search,
				R.drawable.search_select, R.drawable.search_unselect));
		this.addView(new MenuLinearLayout(context, R.string.bottom_menu_more,
				R.drawable.more_select, R.drawable.more_unselect));
		((MenuLinearLayout) this.getChildAt(selectIndex)).changeMenuBgType();

	}

	public MyMenuList(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	/**
	 * 设置布局
	 */
	private void setLayoutParams() {
		this.setLayoutParams(createLayoutParams());
	}

	public LayoutParams createLayoutParams() {
		return new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.FILL_PARENT);
	}
}
